{{include file="public/header" /}}

<!-- conntent start  -->
<div class="am-g my-content login-modal-container">
    <!-- form start -->
    <form class="am-form form-validation" method="post" action="{{:MyUrl('index/user/login')}}" request-type="ajax-fun" request-value="ViewModalBack">
        <div class="xo-padding-horizontal-md-sm login-modal-container-top">
            {{if in_array('sms', MyC('home_user_reg_state')) or in_array('email', MyC('home_user_reg_state')) or in_array('username', MyC('home_user_reg_state'))}}
                <span class="">还没有帐号？</span>
                <a href="{{:MyUrl('index/user/reginfo')}}" target="_blank" class="am-btn am-btn-secondary am-btn-xs am-radius">立即注册</a>
            {{/if}}

            <!-- 用户登录页面顶部钩子 -->
            {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                <div class="plugins-tag">
                    <span>plugins_view_user_login_info_top</span>
                </div>
            {{/if}}
            {{if !empty($plugins_view_user_login_info_top_data) and is_array($plugins_view_user_login_info_top_data)}}
                {{foreach $plugins_view_user_login_info_top_data as $hook}}
                    {{if is_string($hook) or is_int($hook)}}
                        {{$hook|raw}}
                    {{/if}}
                {{/foreach}}
            {{/if}}
        </div>

        <div class="am-form-group am-form-group-refreshing">
            <label>登录账号</label>
            <input type="text" name="accounts" class="am-radius" minlength="1" placeholder="用户名/手机/邮箱" data-validation-message="请填写登录账号" required />
        </div>

        <div class="am-form-group am-form-group-refreshing am-margin-top-xs">
            <label>登录密码</label>
            <input type="password" name="pwd" class="am-radius" placeholder="登录密码" pattern="{{:lang('common_regex_pwd')}}" data-validation-message="密码格式 6~18 个字符之间" required />
        </div>

        {{if MyC('home_user_login_img_verify_state') eq 1}}
            <div class="am-form-group am-form-group-refreshing business-form-block am-margin-top-xs">
                <label>验证码</label>
                <div class="am-input-group am-input-group-sm">
                    <input type="text" name="verify" class="am-radius" placeholder="验证码" minlength="4" maxlength="4" data-validation-message="请输入图片验证码" required />
                    <span class="am-input-group-btn">
                        <span class="am-btn am-btn-default am-radius form-verify">
                            <img src="{{:MyUrl('index/user/userverifyentry', ['type'=>'login'])}}" class="am-radius c-p" id="form-verify-img" onClick="this.src=this.src+'#'+Math.random();" />
                            <a href="javascript:;" class="form-verify-tips" onClick="document.getElementById('form-verify-img').src='{{:MyUrl('index/user/userverifyentry', ['type'=>'login'])}}#'+Math.random();">更换一张</a>
                        </span>
                    </span>
                </div>
            </div>
        {{/if}}
        
        <div class="am-form-group am-form-group-refreshing am-margin-top-sm">
            <button type="submit" class="am-btn am-btn-primary am-radius am-btn-sm btn-loading-example" data-am-loading="{loadingText: '登录中...'}">登录</button>
            <a href="{{:MyUrl('index/user/forgetpwdinfo')}}" target="_blank" class="am-fr">忘记密码？</a>
        </div>
    </form>
    <!-- form end -->
</div>
<!-- conntent end  -->

{{include file="public/footer" /}}

<script type="text/javascript">
    // 返回处理
    function ViewModalBack(e)
    {
        if(e.code == 0)
        {
            $.AMUI.progress.done();
            Prompt(e.msg, 'success');

            // 登录返回html处理
            if((e.data.body_html || null) != null)
            {
                $('body').append(e.data.body_html);
            }

            setTimeout(function()
            {
                window.parent.location.reload();
            }, 1500);
        } else {
            $('form.form-validation').find('button[type="submit"]').button('reset');
            $.AMUI.progress.done();
            Prompt(e.msg);
        }
    }
</script>

